package MemberAreas.pages;

import static org.openqa.selenium.support.ui.ExpectedConditions.*;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

public class InternalPage extends AnyPage {

	public InternalPage(PageManager pages) {
		super(pages);
	}
	
  public InternalPage ensurePageLoaded() {
    super.ensurePageLoaded();
    wait.until(presenceOfElementLocated(By.cssSelector("nav")));
    return this;
  }
  
  @FindBy(xpath = "//*[@id=\"logo_container\"]")
  private WebElement logo_container;

  @FindBy(xpath = "//*[@id=\"aside-member-account-link\"]")
  private WebElement myAccountLink;

  @FindBy(xpath = "//*[@id=\"account_container\"]")
  private WebElement accountLink;
  
  @FindBy(css = "nav a[onclick $= '?logout']")
  private WebElement logoutLink;
  
  @FindBy(xpath = "//*[@id=\"account_container\"]")
  private WebElement collectionLink;
  
  @FindBy(xpath = "//*[@id=\"account_container\"]")
  private WebElement musicQueueLink;
  
  public MyAccountPage clickMyAccountPage() {
    myAccountLink.click();
    return pages.myAccountPage;
  }

 
  
  public LoginPage clickLogoutLink() {
	  accountLink.click();
	  logoutLink.click();
      return pages.loginPage;
  }
}
